| Conditions | 2 |
| Total Lines | 16 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
| 14 | |||
| 15 | public async execute(query: GetContactByIdQuery): Promise<ContactView> { |
||
| 16 | const contact = await this.contactRepository.findOneById(query.id); |
||
| 17 | |||
| 18 | if (!contact) { |
||
| 19 | throw new ContactNotFoundException(); |
||
| 20 | } |
||
| 21 | |||
| 22 | return new ContactView( |
||
| 23 | contact.getId(), |
||
| 24 | contact.getFirstName(), |
||
| 25 | contact.getLastName(), |
||
| 26 | contact.getCompany(), |
||
| 27 | contact.getEmail(), |
||
| 28 | contact.getPhoneNumber(), |
||
| 29 | contact.getNotes() |
||
| 30 | ); |
||
| 33 |